package co.id.vivastor.pantau;

import co.id.vivastor.pantau.util.Global;
import android.os.Bundle;
import android.app.Activity;
import android.graphics.PixelFormat;
import android.view.Menu;
import android.view.Window;
import android.widget.ImageView;

public class MainActivity extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		_setOtherViews();
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.activity_main, menu);
		return true;
	}
	
	@Override
	public void onAttachedToWindow() {
		super.onAttachedToWindow();
		Window window = getWindow();
		window.setFormat(PixelFormat.RGBA_8888);
	}

	
	private void _setOtherViews() {
		ImageView menuLogistik = (ImageView) findViewById(R.id.menu_logistik);
		ImageView menuKejadian = (ImageView) findViewById(R.id.menu_kejadian);
		ImageView menuSetting = (ImageView) findViewById(R.id.menu_setting);
		ImageView menuHasil = (ImageView) findViewById(R.id.menu_hasil);
		ImageView menuKeamanan = (ImageView) findViewById(R.id.menu_keamanan);
		
		Global.setImageViewButtonListener(menuLogistik, MainActivity.this, LogistikActivity.class);
		Global.setImageViewButtonListener(menuKejadian, MainActivity.this, KejadianActivity.class);
		Global.setImageViewButtonListener(menuSetting, MainActivity.this, SettingActivity.class);
		Global.setImageViewButtonListener(menuHasil, MainActivity.this, HasilActivity.class);
		Global.setImageViewButtonListener(menuKeamanan, MainActivity.this, KeamananActivity.class);
		
		//Icon Clickable goto home menu:
		ImageView icon = (ImageView) findViewById(R.id.imageView1);
		Global.setImageViewButtonListener(icon, MainActivity.this, MainActivity.class);
	}

}
